package cn.xopencode.recordservice.manager.lowroom;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.lowroom.LowRoomRecordConvert;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.rpc.lowroom.dto.LowRoomRecordCreateDTO;
import cn.xopencode.recordservice.rpc.lowroom.dto.LowRoomRecordPageDTO;
import cn.xopencode.recordservice.rpc.lowroom.dto.LowRoomRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.lowroom.vo.LowRoomRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.lowroom.vo.LowRoomRecordPageVO;
import cn.xopencode.recordservice.rpc.lowroom.vo.LowRoomRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.service.lowroom.LowRoomRecordService;
import cn.xopencode.recordservice.service.lowroom.bo.LowRoomRecordCreateBO;
import cn.xopencode.recordservice.service.lowroom.bo.LowRoomRecordUpdateBO;
import cn.xopencode.recordservice.service.robotroom.bo.AdminRecordPageBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LowRoomRecordManager {

    @Autowired
    private LowRoomRecordService lowRoomRecordService;

    public Integer createLowRoomRecord(LowRoomRecordCreateDTO createDTO){
        LowRoomRecordCreateBO bo = LowRoomRecordConvert.INSTANCE.convert(createDTO);
        Integer result = lowRoomRecordService.createLowRoomRecord(bo,bo.getEmpIds());
        return result;
    }

    public PageResult<LowRoomRecordPageVO> pageLowRoomRecord(LowRoomRecordPageDTO pageDTO) {
        PageResult<LowRoomRecordPageVO> boPageResult = lowRoomRecordService.pageLowRoomRecord(LowRoomRecordConvert.INSTANCE.convert(pageDTO));
        return boPageResult;
    }

    public LowRoomRecordUpdateVO getLowRoomRecordById(String id){
        LowRoomRecordUpdateVO updateVO = lowRoomRecordService.getLowRoomRecordById(id);
        return updateVO;
    }

    public Integer updateLowRoomRecord(LowRoomRecordUpdateDTO updateDTO){
        LowRoomRecordUpdateBO bo = LowRoomRecordConvert.INSTANCE.convert(updateDTO);
        Integer result = lowRoomRecordService.updateLowRoomRecord(bo,bo.getEmpIds());
        return result;
    }

    public Integer dealLowRoomRecordException(String recordId){
        return lowRoomRecordService.dealLowRoomRecordException(recordId);
    }

    public PageResult<LowRoomRecordAdminPageVO> getPageAdminLowRoomRecord(AdminRecordPageDTO pageDTO){
        AdminRecordPageBO pageBO = AdminRecordConvert.INSTANCE.convert(pageDTO);
        return lowRoomRecordService.getPageAdminLowRoomRecord(pageBO);
    }
}
